PeekWord
WordValue = PeekWord(Address)
 
Parameters:

    Address = The Address in memory where this data should be read from
Returns:

    WordValue = The word value that was read
 

      The PeekWord function will read a word value directly from memory.



FACTS:


      * You can peek any memory location.

      * Care must be taken when reading directly from memory. Attempting to access memory that is not part of your program will most likely cause your program to crash.

      * Also See Pointer




Mini Tutorial:


      This example creates a bank, grabs this banks memory address (the address of the first byte in memory), pokes various test values and strings into memory, then finally reads them back.

  
  
; Create Bank #1 and allocate 100 bytes of system memory for it
  CreateBank 1,100
  
; Grab the actual address (the pointer) of this banks memory.
  Address=GetBankPtr(1)
  
; Once you have the address of something in memory, you can now
; directly read/write information in it.
  
; While this gives the user great freedom, it also means you can
; crash your program if your not careful.
  
  
; Poke the 8bit byte value 255 into memory
  PokeByte Address,255
  
; Poke the 16bit Word value 64000 into memory
  PokeWord Address+1,64000
  
; Poke the 32bit INteger value $aabbccdd into memory
  PokeInt Address+3,$aabbccdd
  
; Poke the 32bit Floating Point value 123.456 into memory
  PokeFloat Address+7123.456
  
  
; Poke the a null terminated string "Hello World" into memory
  PokeString Address+12"Hello World",0
  
  
  
; Peek and display our byte from memory
  Print PeekByte(Address)
  
; Peek and display our word from memory
  Print PeekWord(Address+1)
  
; Peek and display our Integer value from memory
  Print Hex$(PeekInt(Address+3))
  
; Peek and display our Floating Point value from memory
  Print PeekFloat(Address+7)
  
; Peek and display our null terminated string from memory
  Print PeekString(Address+12,0)
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  
  




This example would output.

  
  255
  64000
  $aabbccdd
  123.456
  Hellow World
  

 
Related Info: PeekByte | PeekFloat | PeekInt | PeekString | PokeByte | PokeFloat | PokeInt | PokeString | PokeWord :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com